/****************************************************************************************
**  File: Quaternion.hpp
**  Author: Asteroth
**  Date: 22/02/2009
****************************************************************************************/

#ifndef __QUATERNION_HPP__
#define __QUATERNION_HPP__

template <class T>
class Quaternionx
{
    public:
        T X, Y, Z, W;

        // --- Constructors ----------------------------------------------------
        Quaternionx();
        Quaternionx(const Quaternionx<T> &qt);
        Quaternionx(T x, T y, T z, T w);
        Quaternionx(const Vector2x<T> &vec);
        Quaternionx(const Vector3x<T> &vec);

        inline Quaternionx<T> &operator = (const Vector2x<T> &vec);
        inline Quaternionx<T> &operator = (const Vector3x<T> &vec);
};

typedef Quaternionx<float> Quaternion;

template <class T> Quaternionx<T>::Quaternionx()
    { X = (T)0.0; Y = (T)0.0; Z = (T)0.0; W = (T)1.0; }
template <class T> Quaternionx<T>::Quaternionx( const Quaternionx<T> &qt )
    { X = qt.X; Y = qt.Y; Z = qt.Z; W = qt.W; }
template <class T> Quaternionx<T>::Quaternionx( T x, T y, T z, T w )
    { X = x; Y = y; Z = z; W = w; }
template <class T> Quaternionx<T>::Quaternionx(const Vector2x<T> &vec)
    { X = vec.X; Y = vec.Y; Z = 0.0f; W = 1.0f; }
template <class T> Quaternionx<T>::Quaternionx(const Vector3x<T> &vec)
    { X = vec.X; Y = vec.Y; Z = vec.X; W = 1.0f; }

template <class T> Quaternionx<T> &Quaternionx<T>::operator = (const Vector2x<T> &vec)
    { X = vec.X; Y = vec.Y; Z = 0.0f; W = 1.0f; return *this; }
template <class T> Quaternionx<T> &Quaternionx<T>::operator = (const Vector3x<T> &vec)
    { X = vec.X; Y = vec.Y; Z = vec.X; W = 1.0f; return *this; }

#endif
